<?php

class log_User_Model extends CI_Model {

    public function __construct() {
        $this->load->database();
    }
    
    public function getLogUser($whr, $offset) {
        if ($whr == "") {
            $sql = "SELECT * FROM audit_trail ORDER BY log_time DESC
                    LIMIT " . PAGES_LIMIT . " OFFSET " . $offset;
        } else {
            $sql = "SELECT * FROM audit_trail WHERE " . $whr
                    . " ORDER BY log_time DESC LIMIT " . PAGES_LIMIT . " OFFSET " . $offset;
        }
        $resultSet = $this->db->query($sql);
        return $resultSet;
    }

    public function getLogUserAll($whr) {
        if ($whr == "") {
            $sql = "SELECT * FROM audit_trail ORDER BY log_time DESC";
        } else {
            $sql = "SELECT * FROM audit_trail WHERE " . $whr ." ORDER BY log_time DESC";
        }
        
        $resultSet = $this->db->query($sql);
        return $resultSet;
    }

}

?>
